import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class Ticket {
    private String ticketId;
    private Screening screening;
    private List<Seat> seats;
    private double totalPrice;
    private Date buyTime;
    private int totalTickets;
    private double totalAmount;
    private int refundTickets;
    private double refundAmount;
    private boolean isRefunded = false;
    private boolean refunded;
    public Ticket(String ticketId, Screening screening, List<Seat> seats, double totalPrice, Date buyTime,int totalTickets,double totalAmount,int refundTickets,double refundAmount) {
        this.ticketId = ticketId;
        this.screening = screening;
        this.seats = new ArrayList<>();
        this.totalPrice = totalPrice;
        this.buyTime = buyTime;
        this.totalTickets=totalTickets;
        this.totalAmount=totalAmount;
        this.refundTickets=refundTickets;
        this.refundAmount=refundAmount;
    }
    public void sell(int quantity, double price) {
        this.totalTickets += quantity;
        this.totalAmount += quantity * price;
    }
    public void addSeat(Seat seat){
        if(this.seats==null){
            this.seats=new ArrayList<>();
        }
        this.seats.add(seat);
    }
    public boolean isRefunded() {
        return isRefunded;
    }
    public Double getTotalPrice(){
        return totalPrice;
    }
    public void refund() {
        this.isRefunded = true;
    }
    public void setBuyTime(Date buyTime){
        this.buyTime=buyTime;
    }
    public int getTotalTickets(){
        return totalTickets;
    }
    public double getTotalAmount(){
        return totalAmount;
    }
    public int getRefundTickets(){
        return refundTickets;
    }
    public void setRefundAmount(double refundAmount){
        this.refundAmount=refundAmount;
    }
    public void setRefundTickets(int refundTickets){
        this.refundTickets=refundTickets;
    }
    public void setTotalTickets(int totalTickets){
        this.totalTickets=totalTickets;
    }
    public void setTotalAmount(double refundAmount){
        this.refundAmount=refundAmount;
    }
    public void refund(int refundTickets, double refundAmount) {
        this.refunded = true;
        this.refundTickets = refundTickets;
        this.refundAmount = refundAmount;
    }
    public double getRefundAmount(){
        return refundAmount;
    }
    public String getTicketId() {
        return ticketId;
    }
    public List<Seat> getSeats(){
        return seats;
    }
    public Screening getScreening(){
        return screening;
    }
    public Date getBuyTime(){
        return buyTime;
    }
}

